package com.zrm.zfcrpa.utils;

import org.apache.commons.lang3.StringUtils;


public class StringUtil {
	public static boolean isNullOrBlank(String str) {
		if (StringUtils.isBlank(str)) {
			return true;
		} else {
			str = str.trim();
			return "null".equalsIgnoreCase(str);
		}
	}
	
	public static String trim(String str) {
		if (str == null) {
			return null;
		} else {
			str = str.trim();
			return str.length() == 0 ? null : str;
		}
	}
	
	public static String[] split(String str, String regex) {
		if (str == null) {
			return null;
		}else {
			String[] strResult = str.split(regex);
			return strResult;
		}
	}
	
	public static String connect(String[] strGroup, String regex){
		if (strGroup == null) {
			return null;
		}else {
			StringBuffer strBuf = new StringBuffer();
			if(strGroup.length>0){
				for(String str : strGroup){
					strBuf.append(str).append(regex);
				}
				return strBuf.toString().substring(0, strBuf.length()-1);
			}else{
				return null;
			}
		}
	}
	
	public static String substring(String str, int start, int end){
		if (str == null) {
			return null;
		}else {
			return str.substring(start, end);
		}
	}
}
